<?php
use Illuminate\Http\Request;


Route::group(['prefix' => 'v1', 'namespace' => 'Admin\v1'], function ($route) {
    
    $route->post('admin/login', 'AdminController@login');  //超级管理员登录
    $route->group(['middleware' => 'AdminAuth'], function($route){
        $route->post('admin/apikeys', 'AdminController@apikeys');    //用户apikey列表
        $route->post('admin/charging_schemes', 'AdminController@chargingSchemes');    //计费方案列表
        $route->post('admin/add_charging_scheme', 'AdminController@addChargingScheme');    //添加计费方案列表
        $route->put('admin/update_charging_scheme', 'AdminController@updateChargingScheme');    //修改计费方案
        $route->put('admin/update_apikeys_status', 'AdminController@updateApiKeyStatus');   //修改apikey状态
        $route->post('admin/charges', 'AdminController@charges');   //用户详细财务流水
        $route->post('admin/customers', 'AdminController@customers');   //用户财务中心
        $route->put('admin/update_customer_status', 'AdminController@updateCustomerStatus');   //用户详细财务流水
        $route->post('admin/manual_recharge', 'AdminController@manualRecharge');   //用户详细财务流水
        $route->get('admin/apikey/apigateway', 'AdminController@apiGateways');  //用户apikey已关联的api
        $route->post('admin/apikey/create', 'AdminController@createApiKey')->middleware('CreateApiKey');   //创建apikey
        $route->post('admin/apikey/gateway_status', 'AdminController@gatewayStatus');   //授权或取消apikey关联api
        $route->delete('admin/apikey/delete', 'AdminController@delete');    //删除apikey
    });

    $route->get('test', 'TestController@index')->name('Admin.index');
    $route->get('get-areacode', 'SMSController@getAreaCodes');  //获取手机区号
    $route->post('verifycode/login', 'SMSController@loginVerifyCodeSMS');   //获取登录验证码
    $route->post('verifycode/register', 'SMSController@registerVerifyCodeSMS'); //获取注册验证码
    // $route->get('verifycode/send', 'TestController@sendVerifyCodeSMS')->name('Admin.verifycode');
    $route->post('customer/login', 'CustomerLoginController@login');    //用户登录
    $route->post('customer/register', 'CustomerRegisterController@register');   //用户注册

    $route->group(['middleware' => 'CustomerAuth'], function($route){
        $route->get('customer/info', 'CustomerLoginController@getCustomerInfo');    //用户信息

        $route->post('apikey/info','ApiKeyController@info');    //apikey信息
        $route->post('apikey/status/update','ApiKeyController@update'); //修改apikey
        $route->post('apikey/logs','ApiKeyController@logs');    //apikey的调用日志
        $route->delete('apikey/delete','ApiKeyController@delete');  //删除apikey
        $route->post('apikey/create','ApiKeyController@create')->middleware('CustomerCreateApiKey');    //创建apikey
        $route->post('apikeys','ApiKeyController@apikeys'); //获取apikey列表
        $route->get('apikey/apigateway', 'ApiKeyController@apiGateways');   //apikey已关联的api

        $route->post('bundle/info','BundleController@info');
        $route->post('bundle/status/update','BundleController@update');
        $route->post('bundle/logs','BundleController@logs');
        $route->delete('bundle/delete','BundleController@delete');
        $route->post('bundle/create','BundleController@create');
        $route->post('bundles','BundleController@bundles');

        $route->post('customer/charges', 'ChargeController@charges');
    });
    
    $route->get('docs', 'ApiDocumentController@index'); //获取api文档
    $route->get('doc/detail', 'ApiDocumentController@detail');  //api文档详情
});